package designs.observes.star.impl;

import designs.observes.fan.Fan;
import designs.observes.star.Stars;

import java.util.ArrayList;
import java.util.List;

public class StartsImpl implements Stars {
    //明星名
    private String starName;

    //保存粉丝
    private List<Fan> fanList=new ArrayList<Fan>();

    public StartsImpl() {
    }


    public StartsImpl(String starName) {
        this.starName = starName;
    }

    public void addFan(Fan fan) {
        fanList.add(fan);
    }

    //告诉粉丝我的动态
    public void notify(String message) {
        for (Fan fan : fanList) {
            fan.update(message);
        }
    }


}
